﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdPsPlotStyleTable : OdRxObject
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdPsPlotStyleTable(IntPtr cPtr, bool cMemoryOwn) : base(GlobalsPINVOKE.OdPsPlotStyleTable_SWIGUpcast(cPtr), cMemoryOwn)
		{
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdPsPlotStyleTable obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdPsPlotStyleTable()
		{
			this.Dispose();
		}

		public override void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdPsPlotStyleTable(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
			base.Dispose();
		}

		public new static OdPsPlotStyleTable cast(OdRxObject pObj)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdPsPlotStyleTable_cast(OdRxObject.getCPtr(pObj));
			OdPsPlotStyleTable result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdPsPlotStyleTable)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdPsPlotStyleTable)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdPsPlotStyleTable)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new static OdRxClass desc()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdPsPlotStyleTable_desc(), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxClass isA()
		{
			OdRxClass result = (OdRxClass)Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdPsPlotStyleTable_isA(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject queryX(OdRxClass protocolClass)
		{
			OdRxObject result = Teigha.Core.Helpers.odrxCreateObjectInternal(GlobalsPINVOKE.OdPsPlotStyleTable_queryX(this.swigCPtr, OdRxClass.getCPtr(protocolClass)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public static OdPsPlotStyleTable createObject()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdPsPlotStyleTable_createObject();
			OdPsPlotStyleTable result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdPsPlotStyleTable)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdPsPlotStyleTable)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdPsPlotStyleTable)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual OdRxObject clone()
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdPsPlotStyleTable_clone(this.swigCPtr);
			OdRxObject result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject(Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public new virtual void copyFrom(OdRxObject pSource)
		{
			GlobalsPINVOKE.OdPsPlotStyleTable_copyFrom(this.swigCPtr, OdRxObject.getCPtr(pSource));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual bool isApplyScaleFactor()
		{
			bool result = GlobalsPINVOKE.OdPsPlotStyleTable_isApplyScaleFactor(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual string description()
		{
			string result = GlobalsPINVOKE.OdPsPlotStyleTable_description(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual double scaleFactor()
		{
			double result = GlobalsPINVOKE.OdPsPlotStyleTable_scaleFactor(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool isDisplayCustomLineweightUnits()
		{
			bool result = GlobalsPINVOKE.OdPsPlotStyleTable_isDisplayCustomLineweightUnits(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual double getLineweightAt(uint index)
		{
			double result = GlobalsPINVOKE.OdPsPlotStyleTable_getLineweightAt(this.swigCPtr, index);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdPsPlotStyle plotStyleAt(string name)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdPsPlotStyleTable_plotStyleAt__SWIG_0(this.swigCPtr, name);
			OdPsPlotStyle result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdPsPlotStyle)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdPsPlotStyle)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdPsPlotStyle)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdPsPlotStyle plotStyleAt(int index)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdPsPlotStyleTable_plotStyleAt__SWIG_1(this.swigCPtr, index);
			OdPsPlotStyle result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdPsPlotStyle)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdPsPlotStyle)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdPsPlotStyle)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual uint plotStyleSize()
		{
			uint result = GlobalsPINVOKE.OdPsPlotStyleTable_plotStyleSize(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual uint lineweightSize()
		{
			uint result = GlobalsPINVOKE.OdPsPlotStyleTable_lineweightSize(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual bool isAciTableAvailable()
		{
			bool result = GlobalsPINVOKE.OdPsPlotStyleTable_isAciTableAvailable(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdPsPlotStyle addNewPlotStyle(string styleName)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdPsPlotStyleTable_addNewPlotStyle(this.swigCPtr, styleName);
			OdPsPlotStyle result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdPsPlotStyle)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdPsPlotStyle)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdPsPlotStyle)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdPsPlotStyle delPlotStyle(OdPsPlotStyle pPsPtr)
		{
			MemoryManager memoryManager = MemoryManager.GetMemoryManager();
			MemoryTransaction currentTransaction = memoryManager.GetCurrentTransaction();
			IntPtr p = GlobalsPINVOKE.OdPsPlotStyleTable_delPlotStyle(this.swigCPtr, OdPsPlotStyle.getCPtr(pPsPtr));
			OdPsPlotStyle result;
			if (currentTransaction != null)
			{
				currentTransaction.AddObject((OdPsPlotStyle)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true));
				result = (OdPsPlotStyle)Teigha.Core.Helpers.odrxCreateObjectInternal(p, false);
			}
			else
			{
				result = (OdPsPlotStyle)Teigha.Core.Helpers.odrxCreateObjectInternal(p, true);
			}
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual void setDescription(string desc)
		{
			GlobalsPINVOKE.OdPsPlotStyleTable_setDescription(this.swigCPtr, desc);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setScaleFactor(double scFac)
		{
			GlobalsPINVOKE.OdPsPlotStyleTable_setScaleFactor(this.swigCPtr, scFac);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setApplyScaleFactor(bool flag)
		{
			GlobalsPINVOKE.OdPsPlotStyleTable_setApplyScaleFactor(this.swigCPtr, flag);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setDisplayCustomLineweightUnits(bool flag)
		{
			GlobalsPINVOKE.OdPsPlotStyleTable_setDisplayCustomLineweightUnits(this.swigCPtr, flag);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setLineweightAt(double value, uint index)
		{
			GlobalsPINVOKE.OdPsPlotStyleTable_setLineweightAt(this.swigCPtr, value, index);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setLineweights(OdGeDoubleArray lineweights)
		{
			GlobalsPINVOKE.OdPsPlotStyleTable_setLineweights(this.swigCPtr, OdGeDoubleArray.getCPtr(lineweights));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setAciTableAvailable(bool flag)
		{
			GlobalsPINVOKE.OdPsPlotStyleTable_setAciTableAvailable(this.swigCPtr, flag);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setPlotStylesIndexed(OdPsPlotStylesArray plotStylesIndexed)
		{
			GlobalsPINVOKE.OdPsPlotStyleTable_setPlotStylesIndexed(this.swigCPtr, OdPsPlotStylesArray.getCPtr(plotStylesIndexed));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setPlotStyles(OdPsPlotStylesMap plotStyles)
		{
			GlobalsPINVOKE.OdPsPlotStyleTable_setPlotStyles(this.swigCPtr, OdPsPlotStylesMap.getCPtr(plotStyles));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void addPlotStyle(OdPsPlotStyle pPs)
		{
			GlobalsPINVOKE.OdPsPlotStyleTable_addPlotStyle(this.swigCPtr, OdPsPlotStyle.getCPtr(pPs));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setOrdering(OdStringArray order)
		{
			GlobalsPINVOKE.OdPsPlotStyleTable_setOrdering(this.swigCPtr, OdStringArray.getCPtr(order));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual OdPsPlotStylesMap plotStyles()
		{
			OdPsPlotStylesMap result = new OdPsPlotStylesMap(GlobalsPINVOKE.OdPsPlotStyleTable_plotStyles(this.swigCPtr), true);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public virtual OdPsPlotStylesArray plotStylesIndexed()
		{
			OdPsPlotStylesArray result = new OdPsPlotStylesArray(GlobalsPINVOKE.OdPsPlotStyleTable_plotStylesIndexed(this.swigCPtr), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		private object locker = new object();

		private HandleRef swigCPtr;
	}
}
